package zk.tool.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.zookeeper.data.Stat;

public class StatUtil {

    /**
     * JSON格式化Stat信息
     *
     * @param stat
     * @return json string of instance of Stat
     */
    public static String formatStatInfo(Stat stat) {
        return stat == null ? "" : JSON.toJSONString(stat,
                SerializerFeature.PrettyFormat, SerializerFeature.WriteDateUseDateFormat);
    }
}
